package com.soft.service;

import com.soft.entity.Department;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.Assert;

import java.util.List;

@SpringBootTest
public class DepartmentServiceTest {
    @Autowired
    private DepartmentService departmentService;
    @Test
    public void queryAllTest(){
        List<Department> departments = departmentService.queryAll();
        Assert.isTrue(departments.size()>0,"error");
    }
    @Test
    public void queryDepartmentNameByStudentNameTest(){
        String name=departmentService.queryDepartmentNameByStudentName("张三");
        Assert.isTrue(name.equals("计算机系"),"error");
    }
    @Test
    public void countStudentNumbersByDepartmentNameTest(){
        int num=departmentService.countStudentNumbersByDepartmentName("计算机系");
        Assert.isTrue(num==9,"error");
    }

}
